<!DOCTYPE HTML>
<html lang="en">
<head>
    <title>家乐福交易管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" />
    <link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="//cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css" />
    <link rel="stylesheet" href="/assets/adminlte-2.3.7/css/AdminLTE.min.css"  />
    <link rel="stylesheet" href="/assets/adminlte-2.3.7/css/skins/_all-skins.min.css" />
    <link rel="stylesheet" href="/layui/css/layui.css" />
    <link rel="stylesheet" href="/css/app.css" />
    <!--[if lt IE 9]>
    <script src="//cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
    <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue fixed sidebar-mini">
<div class="wapper">
    <header class="main-header">
        <a href="/console/index" class="logo">
            <span class="logo-mini"><b>家乐福</b></span>
            </b>交易管理</span>
        </a>
        <nav class="navbar navbar-static-top">
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="/assets/adminlte-2.3.7/img/user2-160x160.jpg" class="user-image" />
                            <span class="hidden-xs" th:text="${admin.username}"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="user-header">
                                <img src="/assets/adminlte-2.3.7/img/user2-160x160.jpg" class="img-circle" />
                                <p th:text="${admin.username}"></p>
                                <small th:text="${admin.updatedAt}"></small>
                            </li>
                            <li class="user-footer">
                                <div class="pull-left">
                                    <button id="update" class="btn btn-default btn-flat">修改</button>
                                </div>
                                <div class="pull-right">
                                    <a href="/console/logout" class="btn btn-default btn-flat">退出</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <aside class="main-sidebar">
        <section class="sidebar">
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="/assets/adminlte-2.3.7/img/user2-160x160.jpg" class="img-circle" />
                </div>
                <div class="pull-left info">
                    <p th:text="${admin.username}"></p>
                    <small th:text="${admin.updatedAt}"></small>
                </div>
            </div>
            <ul class="sidebar-menu">
                <!--<li class="header">控制面板</li>-->
                <li class="treeview" th:each="menuList:${menuLists}">
                    <a href="#">
                        <i class="fa fa-dashboard"></i>
                        <b th:text="${menuList.menuName}"></b>
                        <span class="pull-right-container">
                            <i class="fa fa-angle-left pull-right"></i>
                        </span>
                    </a>
                    <ul class="treeview-menu">
                        <li th:each="menuChild:${menuList.children}">
                            <a th:href="${menuChild.menuUrl}" target="mainFrame"><i class="fa fa-cicle-o"></i><b th:text="${menuChild.menuName}"></b></a>
                        </li>
                    </ul>
                </li>
            </ul>
        </section>
    </aside>
    <div class="content-wrapper">
        <iframe name="mainFrame" id="mainFrame" src="/console/main" frameborder="false" scrolling="auto" style="border:none;" width="100%" height="auto" allowtransparency="true"></iframe>
    </div>
    <footer class="main-footer navbar-fixed-bottom" style="border: 0px">
        <div class="pull-right hidden-xs">
            <b>Version</b> 1.0.0
        </div>
        <strong>家乐福交易管理系统.</strong>
    </footer>
</div>
<div class="updateFrom" style="display: none"  lay-filter="updateFrom" id="updateFrom">
    <div class="col-md-12 col-md-offset-3" style="margin:0px">
        <div class="box box-primary">
            <div class="box-header with-border">
                <!--<h3 class="box-title" th:text="'管理员'+${#strings.isEmpty(admin.uid)?'添加':'修改'}"></h3>-->
                <h3 class="box-title">修改密码</h3>
            </div>
            <div class="box-body"><!--form-horizontal js-ajax-form  -->
                <div class="my-div-sm layui-form" action="/console/admin/updatePassWord" method="post">
                    <input type="hidden" name="uid" id="uid" th:value="${admin.uid}" />
                    <input type="hidden" name="createdAt" th:value="${admin.createdAt}" />
                    <input type="hidden" name="updatedAt" th:value="${admin.updatedAt}" />
                    <input type="hidden" name="isSystem" th:value="${admin.isSystem}" />
                    <div class="form-group">
                        <label for="username" class="col-sm-3 control-label">账号</label>
                        <div class="col-sm-9">
                            <input type="text" name="username" class="form-control" id="username" th:readonly="${!#strings.equals(admin.uid,null)}" th:value="${admin.username}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="oldPassword" class="col-sm-3 control-label">原密码</label>
                        <div class="col-sm-9">
                            <input type="password" name="oldPassword" class="form-control" id="oldPassword" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="newPassword" class="col-sm-3 control-label">新密码</label>
                        <div class="col-sm-9">
                            <input type="password" name="newPassword" class="form-control" id="newPassword" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="surePassword" class="col-sm-3 control-label">确认密码</label>
                        <div class="col-sm-9">
                            <input type="password" name="surePassword" class="form-control" id="surePassword" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-3 col-sm-9">
                            <!--<button type="submit" class="btn btn-default">提交</button>-->
                            <button class="layui-btn layui-btn-sm layui-btn-warm" lay-submit  lay-filter="sub">提交</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.bootcss.com/jquery-migrate/1.4.1/jquery-migrate.min.js"></script>
<script type="text/javascript" src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/assets/adminlte-2.3.7/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="/assets/adminlte-2.3.7/js/app.min.js"></script>
<script type="text/javascript" src="/js/index.js"></script>
<script src="/layui/layui.all.js" charset="utf-8"></script>
</body>
</html>
<script>
    layui.use('table', function () {
        element = layui.element;
        var table = layui.table,
            $ = layui.jquery,
            form = layui.form,
            layer = layui.layer;
        var updateMenb;
        $('#update').on('click',function () {
            updateMenb = layer.open({
                type: 1,
                skin: 'my_popup', //样式类名
                title: '<a>修改用户信息</a>',
                area: ['25%', '35%'],
                shadeClose: true, //点击遮罩关闭
                content: $('#updateFrom')
            });
        })
        form.on('submit(sub)', function (data) {
            data = data.field;
            console.log("data:",JSON.stringify(data));
            $.ajax({
                url: "/users/updatePassWord",
                async: false,
                data: data,
                success: function (d) {

                    if (d.info) {
                        layer.msg("密码修改成功");
                        layer.close(updateMenb)
                    }else{
                        layer.msg(d.msg);
                    }
                },
                error:function (e) {
                    console.log(e)
                    layer.msg("ajax执行失败")
                }
            });
            // 流水号，病人id，文档id，文档路径
        })
    })
</script>